import Vue from 'vue'
import App from '@/App.vue'
import router from '@/router'
import store from '@/store'
import '@/plugins/element.js'
import * as API from '@/api'

// 引入mock模拟服务器数据
import '@/mock/mockServe.js'
// VeeValidate表单验证
import '@/plugins/VeeValidate.js'
// 图片懒加载
import VueLazyload from 'vue-lazyload'

import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'

import { Icon, Pagination, MessageBox } from 'element-ui'

// 注册全局三级联动导航
Vue.component(TypeNav.name, TypeNav)
Vue.component(Carousel.name, Carousel)
Vue.use(Icon)
Vue.use(Pagination)
Vue.use(VueLazyload)

Vue.config.productionTip = false

new Vue({
  router,
  store,
  beforeCreate() {
    // 事件总线$bus
    Vue.prototype.$bus = this
    Vue.prototype.$API = API
    Vue.prototype.$msgbox = MessageBox
    Vue.prototype.$alert = MessageBox.alert
    Vue.prototype.$confirm = MessageBox.confirm
    Vue.prototype.$prompt = MessageBox.prompt
  },
  render: h => h(App)
}).$mount('#app')
